package com.dong.auth.security.authentication.holder;

import com.dong.auth.security.authentication.Authentication;
/**
 *
 *
 * @author zhaodc
 * @date 2021/10/19 15:54
 **/
public class ThreadLocalAuthenticationHolderStrategy implements DongAuthenticationHolderStrategy{
    private static final ThreadLocal<Authentication> holder = new ThreadLocal<>();
    @Override
    public void clear() {
        holder.remove();
    }

    @Override
    public Authentication get() {
        return holder.get();
    }

    @Override
    public void set(Authentication context) {
        holder.set(context);
    }

    @Override
    public Authentication create() {
        return new Authentication();
    }
}
